home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / Mandlebrot / Mandlebrot Folder / Readme < prev   
Text File  |  1990-05-09  |  4KB  |  83 lines

  1.                     Mandelbrot in LightSpeed C
  2.                     by Bruce Gladstone -- 5/90
  3.  
  4. This program was freely adapted from the MPW Pascal version in"On MacIntosh Programming: Advanced Techniques" by 
  5. Daniel K. Allen, published by Addison-Wesley (pp 87-100).  It's an interesting example since it uses the event loop 
  6. differently from most MAC programs.  The event loop is called from inside the main number crunching program.  So it  
  7. illustrates how you would run compute intensive programs on the MAC and still keep some semblence of the MAC
  8.  interaction.   Some of the changes to Daniel Allen's program (other than the conversion to C are:
  9.  
  10.     1.    I used 'sprintf' and 'CtoPstr' instead of 'Num2Str' for the data conversions used in the parameter
  11.         displays.   There are some questions I still have about this.  To safely set aside space for the string
  12.         to be converted I use a declaration of Str255 for the string.  This does not match the declaration for
  13.         sprintf but it works if you turn off pointer checking (which I did).  The questions are: What is the
  14.         proper way to call stdio routines if you are in a Mac application?  Is Lightspeed 4.0 with the precomp-
  15.         iled ANSI libraries a step back from 3.0 whid according to <library notes of June 2, 1988> seems to
  16.         allow you to pick out sprintf without all the rest of stdio?  
  17.  
  18.     2.    The 68881 version of the program has the 'Calcmandel' routine embedded as in-line code in 
  19.         'Drawmandel' routine.  This and the conversion to assembly language with removal of some uneccessary 
  20.         loads and stores results in a small speedup.  Bigger improvements come from running under the finder 
  21.         and removing any Inits that monitor operation ala Screensavers. Removing a screensaver INIT and
  22.         running w/o multifinder led to a 30% speedup on a MAC II and IIci.
  23.  
  24.     3.    I broke the program up into six modules and a header file.
  25.  
  26.     4.    I used the more standard approach to creating menus by putting them into a separate resource file.  I 
  27.         did create the windows in the program so that the Mandel window could be the full screen size.
  28.  
  29.     5.    I changed the program slightly from the "successive approximation" Allen used for aesthetic reasons.
  30.  
  31.     6.    I use calls to GetCTable ( numColorBits )to get the default system CLUTs and 
  32.         aColor = (**myColorHandle).ctTable[n].rgb and RGBForeColor ( &aColor ) to pick the color to plot.
  33.  
  34.     I didn't include the projects because they increase the size of the download file quite a bit.  The files to 
  35.     included to make a non-68881 version of the code are:
  36.         
  37.             AboutMandel.c
  38.             DrawMandel.c
  39.             Event.c
  40.             MacTraps
  41.             Mandelbrot.c
  42.             Menu.c
  43.             MenuUpdate.c
  44.         --------------------
  45.             ANSI          /* in its own segment     */
  46.  
  47.     and...    The Lightspeed C options are:        The project type is:        
  48.  
  49.             MacsBug Symbols     No        Application
  50.             Profile        No        File Type    APPL
  51.             68020 code        No        Creator    ????
  52.             68881 code        No        Partition    384K
  53.             <Macheaders>        No        MF Attrs    0800 
  54.             Require prototypes    Yes
  55.             Check pointers    Yes (except for MenuUpdate.c)
  56.  
  57.     The files to included to make a 68881 version of the code are:
  58.         
  59.             AboutMandel.c
  60.             DrawMandel881.c
  61.             Event.c
  62.             MacTraps
  63.             Mandelbrot.c
  64.             Menu.c
  65.             MenuUpdate.c
  66.         --------------------
  67.             ANSI-881         /* in its own segment     */
  68.  
  69.     and...    The Lightspeed C options are:        The project type is:        
  70.  
  71.             MacsBug Symbols     No        Application
  72.             Profile        No        File Type    APPL
  73.             68020 code        Yes        Creator    ????
  74.             68881 code        Yes        Partition    384K
  75.             <Macheaders>        No        MF Attrs    0800 
  76.             Require prototypes    Yes
  77.             Check pointers    Yes (except for MenuUpdate.c)
  78.  
  79.         
  80. FINALLY A WARNING.  This program can be an incredible time sink.  The variations are innumerable and all tempting. 
  81. Avoid the temptation to fiddle endlessly. I am publishing this so that I can concentrate on more productive activities.
  82. I think I have extracted all the 'learning about programming the Mac' from this example that I can.   
  83.